package zengjin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import zengjin.mapper.FileMapper;
import zengjin.model.en.File;
import zengjin.service.FileService;

/**
 * @author 19324
 * @description 针对表【file】的数据库操作Service实现
 * @createDate 2025-03-10 15:28:39
 */
@Service
@Slf4j
public class FileServiceImpl extends ServiceImpl<FileMapper, File>
        implements FileService {

    @Value("${uploadLocation.path-file}")
    private String uploadPath;


    @Resource
    private FileMapper fileMapper;

    @Override
    public boolean delete(String fileName) {
        java.io.File file = new java.io.File(uploadPath + fileName);
        log.info("删除文件：" + fileName);
        if (file.exists()) {
            file.delete();
            return true;
        }
        return false;
    }


}




